package com.itheima.app.controller;

import com.itheima.app.manager.DataManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
public class DataTotalController {

    @Autowired
    DataManager dataManager;

    //数据统计
    @GetMapping("/users/counts")
    public ResponseEntity DataTotal(){

        return dataManager.DataTotal();
    }
    //互相喜欢 喜欢 粉丝 谁看过我 用户列表
    @GetMapping("/users/friends/{type}")
    public ResponseEntity FindUserByPage(@PathVariable Integer type,
                                         @RequestParam(value = "page",defaultValue = "1") Integer PageNum,
                                         @RequestParam(value = "pagesize",defaultValue = "10") Integer pageSize){

        return dataManager.FindUserByPage(PageNum,pageSize,type);
    }
    //粉丝-喜欢
    @PostMapping("/users/fans/{uid}")
    public ResponseEntity fansLove(@PathVariable Long uid){


        return dataManager.fansLove(uid);
    }

    //喜欢-取消
    @DeleteMapping("/users/like/{uid}")
    public ResponseEntity cancleLove(@PathVariable Long uid){

        return dataManager.cancleLove(uid);
    }

}
